<?php
header("content-type:text/html;charset=utf8");
//接受用户名和密码数据
$phone = $_POST["phone"];
$password = $_POST["password"];
$con = mysqli_connect('localhost','root','root','2021');
mysqli_query($con,"set names utf8");
//检测用户名是否被注册
$res = mysqli_query($con,"select * from uss where phone='$phone'");
$row = mysqli_fetch_assoc($res);
if($row){
    if($password ===$row['password']){
        $arr = [
            "meta"=>[
                "status"=>1,
                "message" =>"登录成功"
            ],
            "data" =>null
        ];
    }else{
        $arr = [
            "meta"=>[
                "status"=>0,
                "message" =>"用户名或密码不正确"
            ],
            "data" =>null
        ];
    }
}else{
    $arr = [
        "meta"=>[
            "status"=>2,
            "message" =>"用户不存在"
        ],
        "data" =>null
    ];
}
echo json_encode($arr);
